package info.yangguo.service;

import info.yangguo.util.HexUtil;
import info.yangguo.util.Transfer;

/**
 * @author:杨果
 * @date:16/10/1 下午12:22
 *
 * Description:
 *
 */
public class DecodeRequest {
    public static Object[] decode(String hexStr) {
        Object[] result = new Object[5];
        String tmp2 = Transfer.decodeTransferred(hexStr);
        String tmp3 = Transfer.decodeLength(tmp2);
        String tmp4 = Transfer.decodeVerify(tmp3);
        String[] tmp5 = Transfer.decodeMEID(tmp4);
        result[0] = tmp5[0];
        String[] tmp6 = Transfer.decodePhoneNo(tmp5[1]);
        result[1] = tmp6[0];
        String[] tmp7 = Transfer.decodeSerialNo(tmp6[1]);
        result[2] = tmp7[0];
        Object[] tmp8 = Transfer.decodeRequestAttribute(tmp7[1]);
        result[3] = tmp8[0];
        if (((String) tmp8[1]).startsWith("00")) {
            result[4] = Transfer.decodeMessage00((String) tmp8[1]);
        }
        if (((String) tmp8[1]).startsWith("01")) {
            result[4] = Transfer.decodeMessage01((String) tmp8[1]);
        }
        if (((String) tmp8[1]).startsWith("10")) {
            result[4] = Transfer.decodeMessage10((String) tmp8[1]);
        }
        if (((String) tmp8[1]).startsWith("11")) {
            result[4] = Transfer.decodeMessage11((String) tmp8[1]);
        }
        return result;
    }
}
